import { EntitySchema } from '@mikro-orm/core';

export class LeUserLabel {
  id!: string;
  name!: string;
  type: boolean = true;
  status: boolean = true;
  conditionsStatus: boolean = true;
  conditionsSetting?: string;
  filterUser?: string;
  merchantId!: string;
  AppID!: string;
  createdTime?: string;
  updatedTime?: string;
  deletedTime?: string;
  isDeleted: number = 0;
  usersNumber?: number = 0;
}

export const LeUserLabelSchema = new EntitySchema({
  class: LeUserLabel,
  properties: {
    id: { primary: true, type: 'string', columnType: 'bigint' },
    name: { type: 'string', length: 50 },
    type: { type: 'boolean', default: true },
    status: { type: 'boolean', default: true },
    conditionsStatus: { type: 'boolean', default: true },
    conditionsSetting: { type: 'string', columnType: 'text', nullable: true },
    filterUser: { type: 'string', columnType: 'text', nullable: true },
    merchantId: { type: 'string', columnType: 'bigint' },
    AppID: { type: 'string', fieldName: 'AppID', length: 50 },
    createdTime: { type: 'string', columnType: 'bigint', nullable: true, defaultRaw: `0` },
    updatedTime: { type: 'string', columnType: 'bigint', nullable: true, defaultRaw: `0` },
    deletedTime: { type: 'string', columnType: 'bigint', nullable: true, defaultRaw: `0` },
    isDeleted: { type: 'number', columnType: 'tinyint', default: 0 },
    usersNumber: { type: 'number', nullable: true, default: 0 },
  },
});
